# -*- coding: UTF-8 -*-
import sys 
import  lxml.html as html
reload(sys)
sys.setdefaultencoding('utf-8')

pars = {'url':"D:/feature_project.git/test.html",'path':'//p','numer':0}
def gettree(obj):
    print obj
    dom = obj['url']
    mypath = obj['path']
    if 'numer' in obj.keys() and type(obj['numer']) == int:
        numer = obj['numer']
        print 1
    else:
        numer = 0
        print 0
    domtree = html.fromstring(open(dom,'r').read())
    domnode = domtree.xpath(mypath)
    print html.tostring(domnode[numer])
gettree(pars)
